﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MahdieLabDataBaseModel;

public partial class Guest_Help : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        using (DefaultEntityConnection connection = new DefaultEntityConnection())
        {
            foreach (Help help in connection.Helps)
            {
                UserControl helpUserControl = (UserControl)LoadControl("~/UserControl/HelpUserControl.ascx");
                Type helpUserControlType = helpUserControl.GetType();

                System.Reflection.PropertyInfo helpUserControlHeadLine = helpUserControlType.GetProperty("HeadLine");
                System.Reflection.PropertyInfo helpUserControlDescription = helpUserControlType.GetProperty("Description");
                System.Reflection.PropertyInfo helpUserControlPicture = helpUserControlType.GetProperty("Picture");
                System.Reflection.PropertyInfo helpUserControlFile = helpUserControlType.GetProperty("File");

                helpUserControlHeadLine.SetValue(helpUserControl, help.HelpTitle, null);
                helpUserControlDescription.SetValue(helpUserControl, help.Description, null);
                helpUserControlPicture.SetValue(helpUserControl, string.Format("~/Images/Help/{0}", help.ImageUrl), null);
                helpUserControlFile.SetValue(helpUserControl, string.Format("~/Files/Help/{0}", help.FileUrl), null);


                Info.Controls.Add(helpUserControl);
            }
        }            
    }
}